package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Create a connection with a specific database.
 */
public class ConnectionFactory {

	private String url_connection = "jdbc:mysql://localhost/crud";
	private String user = "crud_user";
	private String pass = "crud";

	public Connection getConnection() {
		try {
			System.out.println("Trying database connection ...");
			return DriverManager.getConnection(url_connection, user, pass);
		} catch (SQLException e) {
			System.out.println("Error in database connection!");
			throw new RuntimeException(e);
		}
	}

}
